fe93585b10ad150a3bb55fe646060ca4efca74a2,http/http-frontend/src/test/java/org/webpieces/httpfrontend/api/TestRequestResponse.java,TestRequestResponse,http2WithPushPromise,#RequestListenerForTest#,149

Before Change


        HttpResponse responseGot = (HttpResponse) parsedMessages.get(0);
        Assert.assertEquals(responseGot.getStatusLine().getStatus().getKnownStatus(), KnownStatusCode.HTTP_101_SWITCHING_PROTOCOLS);

        UnmarshalState result = http2Parser.prepareToUnmarshal(4096, 4096);
        // Check that we got a settings frame, a headers frame, and a data frame, then a push promise frame
        // then a headers then a data frame
        result = http2Parser.unmarshal(result, leftOverData, Integer.MAX_VALUE);
        List<Http2Msg> frames = result.getParsedFrames();

        Assert.assertEquals(6, frames.size());

After Change


        Memento memento = httpParser.prepareToParse();
        httpParser.parse(memento, dataGen.wrapByteBuffer(bytesWritten));
        List<HttpPayload> parsedMessages = memento.getParsedMessages();
        DataWrapper leftOverData = memento.getLeftOverData();

        // Check that we got an approved upgrade
        Assert.assertEquals(parsedMessages.size(), 1);
        Assert.assertTrue(HttpResponse.class.isInstance(parsedMessages.get(0)));
        HttpResponse responseGot = (HttpResponse) parsedMessages.get(0);
        Assert.assertEquals(responseGot.getStatusLine().getStatus().getKnownStatus(), KnownStatusCode.HTTP_101_SWITCHING_PROTOCOLS);

        UnmarshalState result = http2Parser.prepareToUnmarshal(4096, 4096, Integer.MAX_VALUE);
        // Check that we got a settings frame, a headers frame, and a data frame, then a push promise frame
        // then a headers then a data frame
        result = http2Parser.unmarshal(result, leftOverData);
        List<Http2Msg> frames = result.getParsedFrames();

        Assert.assertEquals(6, frames.size());